part of _;

extension on SearchPage {
  Widget view_searchBar() {
    return Row(
      children: [
        YButton(width: yNavBarHeight(), height: yNavBarHeight(), child: Icon(Icons.close), onTap: () => yFinish()),
        Expanded(
          child: Container(
            padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
            margin: EdgeInsets.only(top: 5, bottom: 5),
            decoration: BoxDecoration(borderRadius: BorderRadius.circular(99), border: Border.all(color: YConfig.themeColor, width: 1.5), color: Colors.white),
            child: TextFormField(
              controller: textController,
              autofocus: true,
              style: TextStyle(fontSize: 14),
              decoration: InputDecoration(
                contentPadding: EdgeInsets.zero,
                hintText: "请输入搜索内容...",
                hintStyle: TextStyle(fontSize: 14),
                border: OutlineInputBorder(borderSide: BorderSide.none),
                suffixIcon: textController.text.isEmpty
                    ? null
                    : GestureDetector(
                        child: Icon(Icons.cancel, color: Colors.grey, size: 20),
                        onTap: () => textController.clear(),
                      ),
              ),
            ),
          ),
        ),
        YButton(
          width: 65,
          height: yNavBarHeight() - 10,
          margin: EdgeInsets.all(5),
          borderRadius: BorderRadius.circular(99),
          decoration: BoxDecoration(color: YConfig.themeColor),
          child: Text("搜索", style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 14)),
          onTap: () => controller_search(),
        ),
      ],
    );
  }
}
